import React from 'react';
import PropTypes from 'prop-types';
import StyleIcon from './style';

const Icon = ({
    icon: IconComponent,
    width = 24,
    height = 24,
    color,
    opacity,
    ...rest
}) => {

    return (
        <StyleIcon color={color} opacity={opacity} {...rest}>
            {IconComponent && <IconComponent width={width} height={height} />}
        </StyleIcon>
    )
}

Icon.propTypes = {
    icon: PropTypes.element,
    width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    color: PropTypes.string,
    opacity: PropTypes.number,
}

export default Icon
